package server;

import java.net.InetAddress;
import java.rmi.*;
import java.rmi.registry.LocateRegistry;

import controlador.Sistema;

import rmi.InterfazRemotaRest;



public class Server {
	
	private int myPort = 1099;
	
	public static void main(String[] args) {	
		new Server();
		
	}

	
	public Server() {
		iniciar();
	}
	
    public void iniciar() {
    	try {
    		LocateRegistry.createRegistry(myPort);	
            InterfazRemotaRest res= Sistema.getInstancia();
            Naming.rebind("//localhost/Restaurant", res);
            System.out.println("Fijado en //localhost/Restaurant");
            System.out.println("Fijado en IP: "+InetAddress.getLocalHost()+" @"+myPort+ "//Restaurant");
		} catch (Exception e) {
			e.printStackTrace();
		}
    }

}
